package jnpf.onlinedev;

import jnpf.base.ActionResult;
import jnpf.base.entity.VisualdevEntity;
import jnpf.exception.DataException;
import jnpf.exception.LoginException;
import jnpf.exception.WorkFlowException;
import jnpf.onlinedev.fallback.OnlineDevApiFallback;
import jnpf.onlinedev.model.VisualdevModelDataCrForm;
import jnpf.onlinedev.model.VisualdevModelDataInfoVO;
import jnpf.utils.FeignName;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.io.IOException;
import java.sql.SQLException;
import java.text.ParseException;

@FeignClient(name = FeignName.VUSUALDEV_SERVER_NAME,fallback = OnlineDevApiFallback.class,path ="/OnlineDev")
public interface OnlineDevApi {

	@PostMapping("/getDetailsDataInfo/{id}/{visualdevId}")
	VisualdevModelDataInfoVO getDetailsDataInfo(@PathVariable("id") String id, @PathVariable("visualdevId") String visualdevId);

	@PostMapping("/infoDataChange/{id}/{visualdevId}")
	VisualdevModelDataInfoVO infoDataChange(@PathVariable("id") String id, @PathVariable("visualdevId") String visualdevId) throws SQLException, DataException, ParseException, IOException;

	@PostMapping("/createData/{modelId}")
	ActionResult createData(@PathVariable("modelId" ) String modelId,
							@RequestParam(value = "tenantId",required = false ) String tenantId,
							@RequestBody VisualdevModelDataCrForm visualdevModelDataCrForm) throws WorkFlowException, LoginException;
}
